home *** CD-ROM | disk | FTP | other *** search
-
- void chder(a,b,c,cder,n)
- double a,b,c[],cder[]; /* c[] and cder[] must not overlap */
- int n;
- {
- register int j;
- register double con,cj1,cdj2,cdj1,cdj;
- con = 2/(b-a);
- cdj1 = 2*(n-1)*c[n-1];
- cj1 = 2*(n-2)*c[n-2];
- cder[n-1] = cdj2 = 0;
- for(j = n-2; --j >= 0;){
- cdj = cdj2+cj1; /* the recursive result of first loop */
- cj1 = 2*j*c[j]; /* prefetch for next loop iteration */
- cder[j+1] = con*(cdj2=cdj1); /* complete final loop */
- cdj1 = cdj; /* compiler doesn't worry about aliasing of locals */
- }
- cder[0] = con*cdj1;
- }
-
-